package com.kyleswebspace.propertyanalyzer;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JOptionPane;

import com.kyleswebspace.deactivator.Deactivator;
import com.kyleswebspace.propertyanalyzer.gui.BaseFrame;
import com.kyleswebspace.propertyanalyzer.gui.FocusMediator;
import com.kyleswebspace.propertyanalyzer.model.DataModel;

public class Main {

	private static final int MIN_WIDTH = 1152;
	private static final int MIN_HEIGHT = 768;
	
	private static DataModel dm;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		/*if (Deactivator.isExpired()) {
			JOptionPane.showConfirmDialog(
					null, 
					"This version of Arca Property Analyzer has expired.", 
					"Version Expired", 
					JOptionPane.DEFAULT_OPTION,
					JOptionPane.WARNING_MESSAGE);
			
			System.exit(0);
		}*/
		
		//check resolution
		Toolkit toolkit = Toolkit.getDefaultToolkit();
		Dimension dimension = toolkit.getScreenSize();
		if (dimension.getWidth() < MIN_WIDTH ||
				dimension.getHeight() < MIN_HEIGHT) {
			JOptionPane.showConfirmDialog(
					null, 
					"Please change your resolution to at least " + MIN_WIDTH + " x " +
					MIN_HEIGHT + ".", 
					"Insufficient Resolution", 
					JOptionPane.DEFAULT_OPTION,
					JOptionPane.ERROR_MESSAGE);
			
			System.exit(0);
		}
		
		dm = new DataModel();
		FocusMediator fm = new FocusMediator();
		BaseFrame bf = new BaseFrame(dm, fm);
		bf.setVisible(true);
		bf.setResizable(false);
	}

}
